package fr.upec.tisdtr.indoorlocation.hardware;

import android.content.Context;
import android.net.ConnectivityManager;
import android.util.Log;

public class WifiManager {
	
	private static final String TAG = "WifiManager";

	private final Context context;
	private final android.net.wifi.WifiManager wifi;

	public WifiManager(Context context) {
		this.context = context;
		this.wifi = (android.net.wifi.WifiManager) context.getSystemService(Context.WIFI_SERVICE);
	}

	public boolean isWifiCurrentConnectionType() {
		return ConnectionManager.getCurrentNetworkType(context) == ConnectivityManager.TYPE_WIFI;
	}
	
	public boolean isWifiEnabled() {
		boolean value = wifi.isWifiEnabled();
		Log.v(TAG, "isWifiEnabled : "+value);
		return value;
	}

	public void setWifiDisabled() {
		Log.v(TAG, "setWifiDisabled");
		wifi.setWifiEnabled(false);
	}
	
	public void setWifiEnabled() {
		Log.v(TAG, "setWifiEnabled");
		wifi.setWifiEnabled(true);
	}

}
